package jdk8特性_壹证通公司面试.lambda.Predicate接口;

import java.util.function.Predicate;

/**
 * Created by hongcaixia on 2019/10/30.
 */
public class MyPredicate {

    public static boolean validateStr(String str, Predicate<String> predicate){
        return predicate.negate().test(str);
    }

    public static void main(String[] args) {
        String str = "abdef";
        boolean b = validateStr(str,(s)->str.length()>5);//形参s
        System.out.println(b);


        boolean b1 = validateStr(str, new Predicate<String>() {
            @Override
            public boolean test(String s) {
                return s.length()>5;
            }
        });

        System.out.println(b1);
    }

}